import smtplib
from email.mime.text import MIMEText
from email.header import Header
	
def mySendMail(receivers,content,subject):
	# 第三方 SMTP 服务
	mail_host="smtp.exmail.qq.com"  #设置服务器
	mail_user="zhouyamin@zhizhi123.com"    #用户名
	mail_pass="ZHOUyamin0826"   #口令 
 
	#发送与接收
	sender = 'zhouyamin@zhizhi123.com'
	# receivers = ['zhouyamin2011@126.com']  # 接收邮件，可设置为你的QQ邮箱或者其他邮箱

	message = MIMEText(content, 'plain', 'utf-8')
	sender_name="Admin"
	message['From'] = Header(sender_name, 'utf-8')
	# message['To'] =  Header(receivers_name, 'utf-8')
	message['Subject'] = Header(subject, 'utf-8')
	try:
		smtpObj = smtplib.SMTP_SSL(mail_host,465) 
		# smtpObj.connect(mail_host,465)    # 25 为 SMTP 端口号
		smtpObj.login(mail_user,mail_pass)  
		smtpObj.sendmail(sender, receivers, message.as_string())
		print ("邮件发送成功")
	except smtplib.SMTPException:
		print ("Error: 无法发送邮件")
#下边是一个调用实例
# mySendMail(['zhouyamin2011@126.com'],'这是一个测试邮件，用于测试封装的邮件发送方法','江上轻烟')


